#include "ros/ros.h"
#include "fyt_msg/CameraParam.h"
#include "fyt_msg/DetectorParam.h"
#include "fyt_msg/RuneParam.h"
#include "fyt_msg/SerialParam.h"

void cameraCallBack(const fyt_msg::CameraParamConstPtr &msg){
    ROS_INFO("camera auto explosure:%d",msg->auto_explosure);
    ROS_INFO("camera auto white balance:%d",msg->auto_white_balance);
    ROS_INFO("camera explosure time:%f",msg->explosure_time);
    ROS_INFO("camera explosure time 1:%f",msg->explosure_time_1);
    ROS_INFO("camera explosure time 2:%f",msg->explosure_time_2);
    ROS_INFO("camera explosure frame rate:%f",msg->frame_rate);
    ROS_INFO("camera explosure width:%d",msg->resolution_width);
    ROS_INFO("camera explosure height:%d",msg->resolution_height);
    ROS_INFO("camera source:%s",msg->source.c_str());
}

void detectorCallBack(const fyt_msg::DetectorParamConstPtr &msg){
    ROS_INFO("detector debug:%d",msg->debug);
    ROS_INFO("detector device:%s",msg->device.c_str());
    ROS_INFO("detector videowriter:%d",msg->video_writer);
    ROS_INFO("detector calctime:%d",msg->calc_time);
    ROS_INFO("input size:%d",msg->input_size);
    ROS_INFO("model path:%s",msg->model_path.c_str());
    ROS_INFO("class name path:%s",msg->class_name_path.c_str());
    ROS_INFO("port_name:%s",msg->port_name.c_str());
    ROS_INFO("use_serial:%d",msg->use_serial);
    ROS_INFO("fx:%f",msg->camera_fx);
    ROS_INFO("fy:%f",msg->camera_fy);
}

void runeCallBack(const fyt_msg::RuneParamConstPtr &msg){
    ROS_INFO("recieved rune msg");
}

void serialCallBack(const fyt_msg::SerialParamConstPtr &msg){
    // ROS_INFO("serial name: %s",msg->port_name.c_str());
    // ROS_INFO("serial use_serial: %d",msg->use_serial);
}

int main(int argc,char **argv){
    
    ros::init(argc,argv,"test_config_node");
    ros::NodeHandle n;

    ros::Subscriber sub_camera=n.subscribe("config_camera",1,cameraCallBack);
    ros::Subscriber sub_rune=n.subscribe("config_rune",1,runeCallBack);
    ros::Subscriber sub_detector=n.subscribe("config_detector",1,detectorCallBack);
    // ros::Subscriber sub_serial=n.subscribe("config_serial",1,serialCallBack);

    ros::spin();



}